//商城mock数据
const Mock = require('better-mock/dist/mock.mp.js')
// 获取购物车列表
Mock.mock('mock/cart/list', {
	'code': 200,
	'msg': '操作成功',
	'data': getCartList()
})

// 获取产品分类列表
Mock.mock('mock/produc/cate/list', {
	'code': 200,
	'msg': '操作成功',
	'data': getProductCateList()
})

// 获取购物车汇总信息（数量和总价格（价格待定））
Mock.mock('mock/cart/count', {
	'code': 200,
	'msg': '操作成功',
	'data': {
		allCount:3,//商品总数量
		allPrice:896,//总价格
	  }
})

// 加入购物车
Mock.mock('mock/cart/save', {
	'code': 200,
	'msg': '操作成功'
	
})

// 修改购物车数量
Mock.mock('mock/cart/num', {
	'code': 200,
	'msg': '操作成功',
	'data': {
		count:3,//商品总数量
	  }
})

// 删除一条或者多条购物车（参数数组，ids）
Mock.mock('mock/cart/delete', {
	'code': 200,
	'msg': '操作成功'

})
// // 获取购物车数量
// Mock.mock('mock/cart/count', {
// 	'code': 200,
// 	'msg': '操作成功',
// 	'data': {
// 		count: 4
// 	}
// })

// 下单
Mock.mock('mock/cart/payOrder', {
	'code': 200,
	'msg': '操作成功',
	'data': {
		orderId: 1234
	}
})


//购物车列表
function getCartList() {
	let cartList = {
		carList: [{
				id: 1,
				attrStatus: 11, //库存
				checked: false, //是否选中 boolean
				productId: 1, //id
				image: '/../../static/images/icon_h_jd@2x.png',
				storeName: '商品名称',
				suk: '23', //属性、规格
				price: 9.00, //单价
				cartNum: 2, //数量
			},
			{
				id: 2,
				attrStatus: 12221,
				checked: 0,
				productId: 122,
				image: '/../../static/images/icon_h_jd@2x.png',
				storeName: '商品名称',
				suk: '23',
				price: 9.00,
				cartNum: 1,
			},
			{
				id: 11,
				attrStatus: 11,
				checked: 0,
				productId: 1,
				image: '/../../static/images/icon_h_jd@2x.png',
				storeName: '商品名称',
				suk: '23',
				price: 9.00,
				cartNum: 2,
			},
			{
				id: 12,
				attrStatus: 12221,
				checked: 0,
				productId: 122,
				image: '/../../static/images/icon_h_jd@2x.png',
				storeName: '商品名称',
				suk: '23',
				price: 9.00,
				cartNum: 1,
			},
			{
				id: 21,
				attrStatus: 11,
				checked: 0,
				productId: 1,
				image: '/../../static/images/icon_h_jd@2x.png',
				storeName: '商品名称',
				suk: '23',
				price: 9.00,
				cartNum: 2,
			},
			{
				id: 22,
				attrStatus: 12221,
				checked: 0,
				productId: 122,
				image: '/../../static/images/icon_h_jd@2x.png',
				storeName: '商品名称',
				suk: '23',
				price: 9.00,
				cartNum: 1,
			},
			{
				id: 31,
				attrStatus: 11,
				checked: 0,
				productId: 1,
				image: '/../../static/images/icon_h_jd@2x.png',
				storeName: '商品名称',
				suk: '23',
				price: 9.00,
				cartNum: 2,
			},
			{
				id: 32,
				attrStatus: 12221,
				checked: 0,
				productId: 122,
				image: '/../../static/images/icon_h_jd@2x.png',
				storeName: '商品名称',
				suk: '23',
				price: 9.00,
				cartNum: 1,
			},
			{
				id: 41,
				attrStatus: 11,
				checked: 0,
				productId: 1,
				image: '/../../static/images/icon_h_jd@2x.png',
				storeName: '商品名称',
				suk: '23',
				price: 9.00,
				cartNum: 2,
			},
			{
				id: 42,
				attrStatus: 12221,
				checked: 0,
				productId: 122,
				image: '/../../static/images/icon_h_jd@2x.png',
				storeName: '商品名称',
				suk: '23',
				price: 9.00,
				cartNum: 1,
			},
			{
				id: 411,
				attrStatus: 11,
				checked: 0,
				productId: 1,
				image: '/../../static/images/icon_h_jd@2x.png',
				storeName: '商品名称',
				suk: '23',
				price: 9.00,
				cartNum: 2,
			},
			{
				id: 421,
				attrStatus: 12221,
				checked: 0,
				productId: 122,
				image: '/../../static/images/icon_h_jd@2x.png',
				storeName: '商品名称',
				suk: '23',
				price: 9.00,
				cartNum: 1,
			}
		],
		carInvalidList: [{
				id: 1,
				attrStatus: 11,
				checked: 0,
				productId: 1,
				image: '/../../static/images/icon_h_jd@2x.png',
				storeName: '商品名称',
				suk: '23',
				price: 9.00,

			},
			{
				id: 2,
				attrStatus: 12221,
				checked: 0,
				productId: 122,
				image: '/../../static/images/icon_h_jd@2x.png',
				storeName: '商品名称',
				suk: '23',
				price: 9.00,

			}
		],
		allPrice: 139, //购物车总价
		allCount: 23, //购物车总数量
	}
	return cartList;
}

function getProductCateList() {
	//产品分类列表
	let productCateList =  [{
			  id: 1,
			  name: '热门服务'
			},{
			  id: 2,
			  name: '保健品'
			},{
			  id: 3,
			  name: '精品推荐'
			}]
  return productCateList;
}
